package com.yujianweb;

//测试数组的三种初始化方式
public class Test02 {
    public static void main(String[] args) {
        //静态初始化
        int [] a = {1,2,3,4};
        Man mans[] = {new Man(1,11), new Man(2,12)};

        System.out.println(a[1]);
        System.out.println(mans[0].getId());

        //动态初始化
        int[] s = new int[10];
        s[0] = 1;
        s[1] = 2;

        Man[] mans01 = new Man[10];
        mans01[0] = new Man(1,11);
        mans01[1] = new Man(2,12);

        //默认初始化
        int[] a2 = new int[2];  //默认值是：0 0
        boolean[] a3 = new boolean[2];  //默认值是：false false
        String[] a4 = new String[2];    //默认值是：null null

    }
}
